package com.corejava.training.collections.car.pre15;

import java.util.*;

public class CellphoneMutableDemo {

	public static void main(String[] args) {

		// 3 instances of CellphoneMutable, which are objects
		CellphoneMutable cellphone1 = new CellphoneMutable();
		cellphone1.setCompany("samsung");
		cellphone1.setDescription("smartphone");
		cellphone1.setModel("galaxy S4");
		cellphone1.setOperatingSystem("Android 4.2.0");
		cellphone1.setPrice(699.89);

		CellphoneMutable cellphone2 = new CellphoneMutable();
		cellphone2.setCompany("Nokia");
		cellphone2.setDescription("smartphone");
		cellphone2.setModel("Lukimia");
		cellphone2.setOperatingSystem("Android 4.2.0");
		cellphone2.setPrice(99.89);

		CellphoneMutable cellphone3 = new CellphoneMutable();
		cellphone3.setCompany("Apple");
		cellphone3.setDescription("smartphone");
		cellphone3.setModel("Iphone 5");
		cellphone3.setOperatingSystem("IOS");
		cellphone3.setPrice(799.89);

		// add above instances to List
		List cellphoneList = new ArrayList();
		cellphoneList.add(cellphone1);
		cellphoneList.add(cellphone2);
		cellphoneList.add(cellphone3);

		// read from the List and print them out, with 1.4 style
		Iterator it = cellphoneList.iterator();
		while (it.hasNext()) {
			CellphoneMutable cm = (CellphoneMutable) it.next();
			System.out.println();
			System.out.println("Cellphone company is: " + cm.getCompany());
			System.out.println("Cellphone model is: " + cm.getModel());
			System.out.println("Cellphone description is: "
					+ cm.getDescription());
			System.out.println("Cellphone operating system is: "
					+ cm.getOperatingSystem());
			System.out.println("Cellphone price is: " + cm.getPrice());
			System.out.println("+++++++++++++++++++++++++++++");
		}

		
	}
	

} // end of class
